using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace ProgressWheelDemo.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class MainViewModel : ViewModelBase
    {
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
            Color = Colors.Blue;
            RotationSpeed = 20;
            InnerCircleRadius = 8;
            OuterCircleRadius = 10;
            SpokeWidth = 4;
            NumberOfSpokes = 10;
            ActivateCommand = new RelayCommand(()=>Active=true);
            DeactivateCommand = new RelayCommand(()=>Active=false);
            StyleCommand = new RelayCommand<WheelStyle>((preset)=> Preset = preset);
            Active = true;
            Preset = WheelStyle.Custom;
        }
        private int _spokeWidth;
        private int _numberOfSpokes;
        private int _innercircleRadius;
        private int _outerCircleRadius;
        private int _rotationSpeed;
        private Color _color;
        private bool _active;
        private WheelStyle _preset;

        public int NumberOfSpokes
        {
            get
            {
                return _numberOfSpokes;
            }
            set
            {
                _numberOfSpokes = value;
                RaisePropertyChanged("NumberOfSpokes");
            }
        }

        public int SpokeWidth
        {
            get { return _spokeWidth; }
            set
            {
                _spokeWidth = value;
                RaisePropertyChanged("SpokeWidth");
            }
        }

        public int InnerCircleRadius
        {
            get { return _innercircleRadius; }
            set
            {
                _innercircleRadius = value;
                RaisePropertyChanged("InnerCircleRadius");
            }
        }

        public int OuterCircleRadius
        {
            get { return _outerCircleRadius; }
            set
            {
                _outerCircleRadius = value;
                RaisePropertyChanged("OuterCircleRadius");
            }
        }

        public int RotationSpeed
        {
            get { return _rotationSpeed; }
            set
            {
                _rotationSpeed = value;
                RaisePropertyChanged("RotationSpeed");
            }
        }

        public Color Color
        {
            get { return _color; }
            set
            {
                _color = value;
                RaisePropertyChanged("Color");
                
            }
        }

        public ICommand ActivateCommand { get; set; }
        public ICommand DeactivateCommand { get; set; }
        public ICommand StyleCommand { get; set; }
        
        public bool Active
        {
            get { return _active; }
            set
            {
                _active = value;
                RaisePropertyChanged("Active");
            }
        }

        public WheelStyle Preset
        {
            get { return _preset; }
            set
            {
                _preset = value;
                RaisePropertyChanged("Preset");
            }
        }
    }
}